const path = require('path')


module.exports = {
    entry: './src/main.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
        publicPath: 'dist/s'
    },
    module: {
        rules: [{
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
                    //css-loader只负责将css文件加载不负责解析
                    //style-loader负责将样式添加到dom，让其生效
                    //使用多个loader时，是从右向左读取
            },
            {
                test: /\.less/,
                use: [{
                        loader: "style-loader"
                    },
                    {
                        loader: "css-loader"
                    },
                    {
                        loader: "less-loader"
                    }
                ]
            }

            , {
                test: /\.(png|jpg|gif|jpeg)/,
                use: {
                    loader: 'url-loader',
                    options: {
                        limit: 15
                            //当加载的图片大于limit时需要使用fild-loader
                    }
                }
            }
        ]
    },
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue.esm.js'
        }
    }
}